﻿@{
    Bundle("jquery_rateit");
    Layout = "../Shared/_Default.cshtml";
    ViewBag.PageTitle = T(Res.Name("Title"), JDM.String(Model.DisplayName));
    ViewBag.PageHistory = true;
}

@section Toolbar
{
    @if(JDM.HasFlags(Model.Flags, "CommentAllowed") &&
        (Svc.IsAuthenticated || JDM.HasFlags(Model.Flags, "AnonCommentAllowed")))
    {
        <a href="@Url.Action(Loc.Act("Comment").Ctrl("Feedback").Area("Wizard").Set(new
        {
            tgtID = JDM.Int32(Model.EntityID),
            tgtType = "seller"
        }).Localized())">@T(Res.Name("Comment"))</a>
    }
}
@section Sidebar
{
    @if(JDM.HasFlags(Model.Flags, "RatingAllowed"))
    {
        <div class="box">
            <section>
            @{
                Html.RenderPartial("_Rating");
            }
            </section>
        </div>
    }
    @{
        var addrs = Model.Addresses as IEnumerable<dynamic>;
        if(addrs.Any())
        {
            <div class="box">
                <header>
                    <h3>@T(Res.Name("Addresses"))</h3>
                </header>
                <section>
                @{
                    Html.RenderPartial("_Addresses", addrs);        
                }
                </section>
            </div>
        }
    }
}
@if(JDM.HasFlags(Model.Flags, "CommentAllowed"))
{
    <div class="box">
        <header>
            <h3>@T(Res.Name("Comments"), JDM.Int32(Model.CommentCount))</h3>
        </header>
        <section>
        @{
            Html.RenderAction(Loc.Act("_Comments").Set(new
            {
                id = JDM.Int32(Model.EntityID)
            }).Localized());
        }
        </section>
    </div>
}
<div class="box">
    <header>
        <h3>@T(Res.Name("Items"))</h3>
    </header>
    <section>
    @{
        Html.RenderAction(Loc.Act("_Latest").Ctrl("Item").Set(new
        {
            sellerID = JDM.Int32(Model.EntityID)
        }).Localized());
    }
    </section>
    <footer>
        <nav>
            <a href="@Url.Action(Loc.Act("Index").Ctrl("Item").Set(new
            {
                sellerID = JDM.Int32(Model.EntityID)
            }).Localized())">@T(Res.In("Common").Of("Vocab").Name("All"))</a>
        </nav>
    </footer>
</div>
